import React, { Component } from 'react';
class list extends Component {

  state = { 
    
   }

  //  删除评论
  del =(index)=>{
    this.props.list.splice(index,1)
    this.setState({
      list:this.props.list
    })
  }


  render() { 
    return ( 
      <>
        <div className='comment'>
          {/* 评论区 */}
          <ul>
            {
              this.props.list.map((item,index)=>{
                return <li key={index}>
                        <span className='span'>评论人：{item.title}</span>
                        <div className='fu'>
                          <div className='spa2'>评论内容：{item.count}</div>
                          <button className='butt' onClick={()=>this.del(index)}>删除评论</button>
                        </div>
                       </li>
              })
            }
          </ul>
        </div>
      </>
     );
  }
}
 
export default list;